home *** CD-ROM | disk | FTP | other *** search
- {---------------------------------------------------------------------
- #
- # Apple Macintosh Developer Technical Support
- #
- # MultiFinder-Aware Simple TextEdit Sample Application
- #
- # OOPTESample
- #
- # UDocument.p - Pascal Source
- #
- # Copyright © 1988, 1989 Apple Computer, Inc.
- # All rights reserved.
- #
- # Versions:
- # 1.00 04/89
- # 1.10 02/90
- # 1.11 10/92
- #
- # Components:
- # BuildOOPTESample February 1, 1990
- # MTESample.p February 1, 1990
- # OOPTESample.make February 1, 1990
- # TECommon.h February 1, 1990
- # TESampleGlue.a February 1, 1990
- # TESample.r February 1, 1990
- # TMLRules.make February 1, 1990
- # UApplication.p February 1, 1990
- # UApplication.inc1.p February 1, 1990
- # UDocument.p February 1, 1990
- # UDocument.inc1.p February 1, 1990
- # UTEDocument.p February 1, 1990
- # UTEDocument.inc1.p February 1, 1990
- # UTESample.p February 1, 1990
- # UTESample.inc1.p February 1, 1990
- #
- ---------------------------------------------------------------------}
-
- UNIT UDocument;
-
- INTERFACE
-
- USES
- Types, QuickDraw, Events, Menus, Devices, ToolUtils, OSUtils, Controls,
- TextEdit, Traps, Windows, Dialogs,
- ObjIntf;
-
- TYPE
- TDocument = OBJECT(TObject)
- fDocWindow: WindowPtr;
-
- PROCEDURE TDocument.IDocument(resID: integer);
- PROCEDURE TDocument.Free; OVERRIDE;
-
- { You will need to override these in your subclasses, since they }
- { do nothing by default. }
- PROCEDURE TDocument.DoZoom(partCode: integer);
- PROCEDURE TDocument.DoGrow(theEvent: EventRecord);
- PROCEDURE TDocument.DoContent(theEvent: EventRecord);
- PROCEDURE TDocument.DoKeyDown(theEvent: EventRecord);
- PROCEDURE TDocument.DoActivate(becomingActive: Boolean);
- PROCEDURE TDocument.DoUpdate;
-
- { File Handling Routines }
- PROCEDURE TDocument.DoOpen;
- PROCEDURE TDocument.DoClose; { By default, we just delete ourself. }
- PROCEDURE TDocument.DoSave;
- PROCEDURE TDocument.DoSaveAs;
- PROCEDURE TDocument.DoRevert;
- PROCEDURE TDocument.DoPrint;
-
- { Standard Edit Menu actions }
- PROCEDURE TDocument.DoUndo;
- PROCEDURE TDocument.DoCut;
- PROCEDURE TDocument.DoCopy;
- PROCEDURE TDocument.DoPaste;
- PROCEDURE TDocument.DoClear;
- PROCEDURE TDocument.DoSelectAll;
-
- { Idle Time routines: you can use these to do cursor handling, }
- { TE caret blinking, marquee effects, etc. }
- PROCEDURE TDocument.DoIdle;
- FUNCTION TDocument.CalcIdle:Longint;
- PROCEDURE TDocument.AdjustCursor(where: Point); { where is in local coords. }
-
- { Query state of document - useful for adjusting menu state }
- FUNCTION TDocument.HaveUndo: Boolean;
- FUNCTION TDocument.HaveSelection: Boolean;
- FUNCTION TDocument.HavePaste: Boolean;
- FUNCTION TDocument.CanClose: Boolean;
- FUNCTION TDocument.CanSave: Boolean;
- FUNCTION TDocument.CanSaveAs: Boolean;
- FUNCTION TDocument.CanRevert: Boolean;
- FUNCTION TDocument.CanPrint: Boolean;
-
- { Utility routine to get window pointer for document }
- FUNCTION TDocument.GetDocWindow: WindowPtr;
- END;
-
-
- TDocumentLink = OBJECT(TObject)
- fNext: TDocumentLink;
- fDoc: TDocument;
-
- PROCEDURE TDocumentLink.IDocumentLink(n:TDocumentLink; v:TDocument);
- FUNCTION TDocumentLink.GetNext:TDocumentLink;
- FUNCTION TDocumentLink.GetDoc: TDocument;
- PROCEDURE TDocumentLink.SetNext(aLink:TDocumentLink);
- PROCEDURE TDocumentLink.SetDoc(aDoc:TDocument);
- END;
-
- TDocumentList = OBJECT(TObject)
- fDocList: TDocumentLink; { the first link in our list }
- fNumDocs: integer; { the number of elements in the list }
-
- PROCEDURE TDocumentList.IDocumentList;
- PROCEDURE TDocumentList.AddDoc(doc:TDocument);
- PROCEDURE TDocumentList.RemoveDoc(doc:TDocument);
- FUNCTION TDocumentList.FindDoc(window:WindowPtr): TDocument;
- FUNCTION TDocumentList.NumDocs:integer;
- END;
-
- IMPLEMENTATION
-
- {$I UDocument.inc1.p}
-
- END.
-